package com.gdkm.edu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    RestTemplate restTemplate;
    @GetMapping("/findOrder")
    public String findOrder(){
        System.out.println("用户查询订单");
        //参数1 远程调用地址 参数2 响应回的数据类型 参数3 数据类型
        String url ="http://localhost:8010/order/findOrder?id={id}&name={name}";
        String orderMsg = restTemplate.getForObject(url, String.class);
        return orderMsg;
    }
}